Rework sled agent ledger handling for old versions#9544
Merged
jgallagher merged 9 commits intomainfrom Jan 7, 2026
Merged
Conversation
labbott
reviewed
Dec 19, 2025
Comment on lines
+263
to
+270
| // v4 config collected from a test system. | ||
| const V4_CONFIG_PATH: &str = "test-data/v4-sled-config.json"; | ||
|
|
||
| // paths for expectorate checks | ||
| const EXPECTORATE_V10_CONFIG_PATH: &str = | ||
| "expectorate/v10-sled-config.json"; | ||
| const EXPECTORATE_V11_CONFIG_PATH: &str = | ||
| "expectorate/v11-sled-config.json"; |
Contributor
There was a problem hiding this comment.
Do you expect these tests to get updated for v12?
Contributor
Author
There was a problem hiding this comment.
Yeah. I realize that's kind of tedious, but it seems pretty important to at least sanity check that we can convert from all prior versions up to the current. Very open to suggestions for any way to make updating these smooth. (I believe as written, the read_config_converts_from_older_versions() won't compile if a new version is added without updating it to account for it. But it should be a couple lines of changes to do so.)
sled-agent/types/versions/src/add_dual_stack_shared_network_interfaces/inventory.rs
Outdated
Show resolved
Hide resolved
labbott
approved these changes
Jan 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@labbott pointed out that adding new sled config versions is quite painful w.r.t. updating the code that reads the ledger, and @bnaecker recently did nontrivial work here (with similar amounts of pain!). Now that done the overall API versioning reorganization work has landed, we can make this a lot cleaner. This PR makes several changes:
v4.main- we would try to read the on-disk ledger asv11; if that failed, we'd try to read it asv4, then convertv4->v10->v11. But we never tried to read it asv10. In this case (IIUC) the v10 -> v11 changes don't affect the on-disk format, so there's no practical impact here. But these changes should make this bug impossible in the future, since the macro defines the order in which we try versions, and we won't skip any.Most of the lines-of-code changed are in test files. I grabbed a newer
v4-sled-config.jsonfrom a real system so we'd have some zones with NICs (which is what changed in v4 -> v10) to confirm the tests are actually doing nontrivial conversions.